/**
 * Copyright (c) 2010 Simple Graph Tools contributors. All rights reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * $Id$
 */
package org.sgt.coredef.util;

import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

import org.sgt.coredef.*;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see org.sgt.coredef.CoredefPackage
 * @generated
 */
public class CoredefSwitch<T1> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static CoredefPackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CoredefSwitch() {
		if (modelPackage == null) {
			modelPackage = CoredefPackage.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T1 doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T1 doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T1 doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case CoredefPackage.DESCRIBED_OBJECT: {
				DescribedObject describedObject = (DescribedObject)theEObject;
				T1 result = caseDescribedObject(describedObject);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.DESCRIPTION: {
				Description description = (Description)theEObject;
				T1 result = caseDescription(description);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.TEXTUAL_DESCRIPTION: {
				TextualDescription textualDescription = (TextualDescription)theEObject;
				T1 result = caseTextualDescription(textualDescription);
				if (result == null) result = caseDescription(textualDescription);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.CONDITION: {
				Condition condition = (Condition)theEObject;
				T1 result = caseCondition(condition);
				if (result == null) result = caseDescribedObject(condition);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.NODE: {
				Node node = (Node)theEObject;
				T1 result = caseNode(node);
				if (result == null) result = caseConditionableObject(node);
				if (result == null) result = caseConstrainedObject(node);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.EDGE: {
				Edge edge = (Edge)theEObject;
				T1 result = caseEdge(edge);
				if (result == null) result = caseConditionableObject(edge);
				if (result == null) result = caseConstrainedObject(edge);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.CHAIN: {
				Chain chain = (Chain)theEObject;
				T1 result = caseChain(chain);
				if (result == null) result = caseConditionableObject(chain);
				if (result == null) result = caseConstrainedObject(chain);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.GRAPH: {
				Graph graph = (Graph)theEObject;
				T1 result = caseGraph(graph);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.CONSTRAINT: {
				Constraint constraint = (Constraint)theEObject;
				T1 result = caseConstraint(constraint);
				if (result == null) result = caseDescribedObject(constraint);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.MAPPING: {
				Mapping mapping = (Mapping)theEObject;
				T1 result = caseMapping(mapping);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.MAPPING_DEFINITION: {
				MappingDefinition mappingDefinition = (MappingDefinition)theEObject;
				T1 result = caseMappingDefinition(mappingDefinition);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.MAPPING_ROLE: {
				MappingRole mappingRole = (MappingRole)theEObject;
				T1 result = caseMappingRole(mappingRole);
				if (result == null) result = caseConstrainedObject(mappingRole);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.DECOMPOSABLE_NODE: {
				DecomposableNode decomposableNode = (DecomposableNode)theEObject;
				T1 result = caseDecomposableNode(decomposableNode);
				if (result == null) result = caseNode(decomposableNode);
				if (result == null) result = caseConditionableObject(decomposableNode);
				if (result == null) result = caseConstrainedObject(decomposableNode);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.DECOMPOSABLE_EDGE: {
				DecomposableEdge decomposableEdge = (DecomposableEdge)theEObject;
				T1 result = caseDecomposableEdge(decomposableEdge);
				if (result == null) result = caseEdge(decomposableEdge);
				if (result == null) result = caseConditionableObject(decomposableEdge);
				if (result == null) result = caseConstrainedObject(decomposableEdge);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.PROXY: {
				Proxy<?> proxy = (Proxy<?>)theEObject;
				T1 result = caseProxy(proxy);
				if (result == null) result = caseDescribedObject(proxy);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.CONDITIONABLE_OBJECT: {
				ConditionableObject conditionableObject = (ConditionableObject)theEObject;
				T1 result = caseConditionableObject(conditionableObject);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.CONSTRAINED_OBJECT: {
				ConstrainedObject constrainedObject = (ConstrainedObject)theEObject;
				T1 result = caseConstrainedObject(constrainedObject);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.GRAPH_CONDITION: {
				GraphCondition graphCondition = (GraphCondition)theEObject;
				T1 result = caseGraphCondition(graphCondition);
				if (result == null) result = caseCondition(graphCondition);
				if (result == null) result = caseDescribedObject(graphCondition);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.GRAPH_CONSTRAINT: {
				GraphConstraint graphConstraint = (GraphConstraint)theEObject;
				T1 result = caseGraphConstraint(graphConstraint);
				if (result == null) result = caseConstraint(graphConstraint);
				if (result == null) result = caseDescribedObject(graphConstraint);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.PROXY_NODE: {
				ProxyNode proxyNode = (ProxyNode)theEObject;
				T1 result = caseProxyNode(proxyNode);
				if (result == null) result = caseProxy(proxyNode);
				if (result == null) result = caseNode(proxyNode);
				if (result == null) result = caseDescribedObject(proxyNode);
				if (result == null) result = caseConditionableObject(proxyNode);
				if (result == null) result = caseConstrainedObject(proxyNode);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case CoredefPackage.PROXY_EDGE: {
				ProxyEdge proxyEdge = (ProxyEdge)theEObject;
				T1 result = caseProxyEdge(proxyEdge);
				if (result == null) result = caseProxy(proxyEdge);
				if (result == null) result = caseEdge(proxyEdge);
				if (result == null) result = caseDescribedObject(proxyEdge);
				if (result == null) result = caseConditionableObject(proxyEdge);
				if (result == null) result = caseConstrainedObject(proxyEdge);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Described Object</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Described Object</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseDescribedObject(DescribedObject object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Description</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Description</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseDescription(Description object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Textual Description</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Textual Description</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseTextualDescription(TextualDescription object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Condition</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Condition</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseCondition(Condition object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Node</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Node</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseNode(Node object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Edge</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Edge</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseEdge(Edge object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Chain</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Chain</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseChain(Chain object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Graph</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Graph</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseGraph(Graph object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Constraint</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Constraint</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseConstraint(Constraint object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Mapping</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Mapping</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseMapping(Mapping object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Mapping Definition</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Mapping Definition</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseMappingDefinition(MappingDefinition object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Mapping Role</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Mapping Role</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseMappingRole(MappingRole object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Decomposable Node</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Decomposable Node</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseDecomposableNode(DecomposableNode object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Decomposable Edge</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Decomposable Edge</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseDecomposableEdge(DecomposableEdge object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Proxy</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Proxy</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public <T> T1 caseProxy(Proxy<T> object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Conditionable Object</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Conditionable Object</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseConditionableObject(ConditionableObject object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Constrained Object</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Constrained Object</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseConstrainedObject(ConstrainedObject object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Graph Condition</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Graph Condition</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseGraphCondition(GraphCondition object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Graph Constraint</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Graph Constraint</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseGraphConstraint(GraphConstraint object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Proxy Node</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Proxy Node</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseProxyNode(ProxyNode object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Proxy Edge</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Proxy Edge</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T1 caseProxyEdge(ProxyEdge object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T1 defaultCase(EObject object) {
		return null;
	}

} //CoredefSwitch
